package com.wnhz.work.yz.activity;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.google.gson.Gson;
import com.wnhz.work.yz.MyApplication;
import com.wnhz.work.yz.R;
import com.wnhz.work.yz.base.BaseRVAdapter;
import com.wnhz.work.yz.base.BaseViewHolder;
import com.wnhz.work.yz.bean.JobProjectBean;
import com.wnhz.work.yz.bean.JobTePiDetailsBean;
import com.wnhz.work.yz.utils.Url;
import com.wnhz.work.yz.utils.xutils3.MyCallBack;
import com.wnhz.work.yz.utils.xutils3.XUtil;
import com.wnhz.work.yz.view.CircularImage;

import org.json.JSONException;
import org.json.JSONObject;
import org.xutils.x;

import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class JobTepiDetailsActivity extends Activity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_job_tepi_details);
        initData();
        initView();
        upLoad(true, true, "", job.getBudget_id());
    }

    private List<JobTePiDetailsBean.InfosEntity> infos = new ArrayList<>();

    private void upLoad(final boolean flag1, final boolean flag2, final String message, String budget_id) {
        Map<String, Object> map = new Hashtable<>();
        map.put("token", MyApplication.getInstance().getUserBean().getToken());
        map.put("budget_id", budget_id);

        XUtil.Post(Url.UCENTER_GETTEPIDETAIL, map, new MyCallBack<String>() {
            @Override
            public void onSuccess(String result) {
                super.onSuccess(result);
                Gson gson = new Gson();
                Log.e("------", result);
                JobTePiDetailsBean tepi = gson.fromJson(result, JobTePiDetailsBean.class);
                if ("1".equals(tepi.getResult())) {
                    infos = tepi.getInfos();
                }
            }

            @Override
            public void onFinished() {
                super.onFinished();
                if (flag1)
                    setData();
                else {
                    tepi_return.append("{\n" +
                            "  \"token\" : \"" + MyApplication.getInstance().getUserBean().getToken() + "\",");
                    tepi_return.append("\"tepi_return\" : [");
                    setData(flag2, message);

                }
            }
        });
    }

    private String toastInfo = "";

    private void allUpLoad() {
        Map<String, Object> map = new Hashtable<>();
        map.put("jsonString", tepi_return);

        Log.e("----", tepi_return + "");
//        Log.e("----", "token---" + MyApplication.getInstance().getUserBean().getToken() + "----" +
//                "tepi_return---" + tepi_return +
//                "tepi_message---" + message);
        XUtil.Post(Url.UCENTER_TEPIALL, map, new MyCallBack<String>() {
            @Override
            public void onSuccess(String result) {
                super.onSuccess(result);
                Log.e("---", "--" + result + "---" + tepi_return);
                try {
                    JSONObject json = new JSONObject(result);
                    toastInfo = json.optString("info");
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }

            @Override
            public void onFinished() {
                Toast.makeText(JobTepiDetailsActivity.this, "" + toastInfo, Toast.LENGTH_SHORT).show();
                finish();
                super.onFinished();
            }
        });
    }

    private StringBuffer tepi_return = new StringBuffer("");
    private int index = 0;

    private void setData(final boolean flag2, final String message) {
        recycler2.setAdapter(new BaseRVAdapter(this, infos) {
            @Override
            public int getLayoutId(int viewType) {
                return R.layout.activity_job_tepi_details_shenqing;
            }

            @Override
            public void onBind(final BaseViewHolder holder, final int position) {
                int tePiStatus = 1;
                try {
                    tePiStatus = Integer.parseInt(infos.get(position).getTepi_status());
                } catch (Exception e) {

                }

                switch (tePiStatus) {
                    case 1:
                        holder.getView(R.id.ll_consent).setVisibility(View.VISIBLE);
                        holder.getView(R.id.ll_consent1).setVisibility(View.GONE);
                        break;
                    case 2:
                        holder.getView(R.id.ll_consent).setVisibility(View.GONE);
                        holder.getView(R.id.ll_consent1).setVisibility(View.GONE);
                        holder.setTextView(R.id.consent_status, "已同意");
                        holder.getTextView(R.id.consent_status).setTextColor(getResources().getColor(R.color.main_color));
                        holder.setTextView(R.id.status, "原因：" + infos.get(position).getTepi_msg());
                        holder.getTextView(R.id.status).setTextColor(getResources().getColor(R.color.main_color));

                        break;
                    case 3:
                        holder.getView(R.id.ll_consent).setVisibility(View.VISIBLE);
                        holder.getView(R.id.ll_consent1).setVisibility(View.GONE);
                        holder.setTextView(R.id.consent_status, "已驳回");
                        holder.getTextView(R.id.consent_status).setTextColor(Color.RED);
                        holder.setTextView(R.id.status, "原因：" + infos.get(position).getTepi_msg());
                        holder.getTextView(R.id.status).setTextColor(Color.RED);
                        break;

                }
                //  Toast.makeText(JobTepiDetailsActivity.this, ""+tePiStatus, Toast.LENGTH_SHORT).show();
                if (tePiStatus == 1) {
                    int type = flag2 ? 2 : 3;
                    String info = flag2 ? "同意" : "驳回";
                    tepi_return.append("  {\n" +
                            "      \"apply_id\" : \"" + infos.get(position).getApply_id() + "\",\n" +
                            "      \"budget_package_id\" : \"" + infos.get(position).getBudget_package_id() + "\",\n" +
                            "      \"type\" : \"" + type + "\",\n" +
                            "      \"tepi_price\" : \"" + infos.get(position).getTepi_price() + "\",\n" +
                            "      \"tepi_message\" : \"" + info + "\"\n" +
                            "    }");

                }
                if (index == infos.size() - 1) {
                    tepi_return.append("  ],\n" +
                            "  \"tepi_message\" : \"" + message + "\"\n" +
                            "}");

                    allUpLoad();
                }
                index++;

            }

        });
    }

    private void setData() {
        //    Toast.makeText(JobTepiDetailsActivity.this, "" + infos.size(), Toast.LENGTH_SHORT).show();
        recycler2.setAdapter(new BaseRVAdapter(this, infos) {
            @Override
            public int getLayoutId(int viewType) {
                return R.layout.activity_job_tepi_details_shenqing;
            }

            @Override
            public void onBind(final BaseViewHolder holder, final int position) {
                int tePiStatus = 1;
                try {
                    tePiStatus = Integer.parseInt(infos.get(position).getTepi_status());
                } catch (Exception e) {

                }

                switch (tePiStatus) {
                    case 1:
                        holder.getView(R.id.ll_consent).setVisibility(View.VISIBLE);
                        holder.getView(R.id.ll_consent1).setVisibility(View.GONE);
                        break;
                    case 2:
                        holder.getView(R.id.ll_consent).setVisibility(View.GONE);
                        holder.getView(R.id.ll_consent1).setVisibility(View.GONE);
                        holder.setTextView(R.id.consent_status, "已同意");
                        holder.getTextView(R.id.consent_status).setTextColor(getResources().getColor(R.color.main_color));
                        holder.setTextView(R.id.status, "审核通过：" + infos.get(position).getTepi_msg());
                        holder.getTextView(R.id.status).setTextColor(getResources().getColor(R.color.main_color));
                        holder.getTextView(R.id.status).setVisibility(View.VISIBLE);
                        break;
                    case 3:
                        holder.getView(R.id.ll_consent).setVisibility(View.GONE);
                        holder.getView(R.id.ll_consent1).setVisibility(View.GONE);
                        holder.setTextView(R.id.consent_status, "已驳回");
                        holder.getTextView(R.id.consent_status).setTextColor(Color.RED);
                        holder.setTextView(R.id.status, "审核失败：" + infos.get(position).getTepi_msg());
                        holder.getTextView(R.id.status).setTextColor(Color.RED);
                        holder.getTextView(R.id.status).setVisibility(View.VISIBLE);
                        break;

                }
                if ("1".equals(total_tepi_stutas)) {
                    ll_consent_boss.setVisibility(View.GONE);
                    shenhe_ing.setVisibility(View.VISIBLE);
                } else if ("2".equals(total_tepi_stutas)) {
                    ll_consent_boss.setVisibility(View.VISIBLE);
                    shenhe_ing.setVisibility(View.GONE);
                } else {
                    shenhe_ing.setVisibility(View.GONE);
                }
                x.image().bind(holder.getImageView(R.id.logo_pic), infos.get(position).getLogo_pic());
                holder.setTextView(R.id.package_name, infos.get(position).getPackage_name());
                holder.setTextView(R.id.nums2, "×" + infos.get(position).getNums());
//                if (!"整体浴室".equals(infos.get(position).getTc_classname())) {
//                    holder.getView(R.id.tc_classname).setBackground(getResources().getDrawable(R.drawable.button_ju));
//                } else {
//                    holder.getView(R.id.tc_classname).setBackground(getResources().getDrawable(R.drawable.button_main));
//                }
                if ("1".equals(infos.get(position).getTypeid())) {
                    holder.getView(R.id.tc_classname).setBackground(getResources().getDrawable(R.drawable.button_ju));
                } else if ("0".equals(infos.get(position).getTypeid())) {
                    holder.getView(R.id.tc_classname).setBackground(getResources().getDrawable(R.drawable.button_main));
                } else if ("2".equals(infos.get(position).getTypeid())) {
                    holder.getView(R.id.tc_classname).setBackground(getResources().getDrawable(R.drawable.buttom_green));
                }
                holder.setTextView(R.id.tc_classname, infos.get(position).getTc_classname());
                holder.setTextView(R.id.room_number_color, "房间号：" + infos.get(position).getRoom_number() + "   配色：" + infos.get(position).getColor());
                holder.setTextView(R.id.package_money, "￥" + infos.get(position).getPackage_money());
                holder.setTextView(R.id.shop_nums, infos.get(position).getNums() + "套");
                final DecimalFormat df = new DecimalFormat("######0.00");
                holder.setTextView(R.id.nums, "￥" + df.format((Double.parseDouble(infos.get(position).getPackage_money()) - Double.parseDouble(infos.get(position).getApply_price())) * Double.parseDouble(infos.get(position).getNums())) + "");
                final EditText edit = holder.getView(R.id.apply_price);
                edit.setText(infos.get(position).getApply_price());
                holder.getView(R.id.consent).setTag(R.id.tepi_price, edit.getText().toString());
                holder.getView(R.id.consent_no).setTag(R.id.tepi_price, edit.getText().toString());
                edit.addTextChangedListener(new TextWatcher() {
                    @Override
                    public void beforeTextChanged(CharSequence s, int start, int count, int after) {

                    }

                    @Override
                    public void onTextChanged(CharSequence s, int start, int before, int count) {
                        String str = edit.getText().toString();
                        double intStr = 0;
                        if (str == null || str.equals("")) {
                            str = "0";
                        }
                        try {
                            intStr = Double.parseDouble(str);
                        } catch (Exception e) {
                            intStr = 0;
                        }

                        double d1 = Double.parseDouble(infos.get(position).getPackage_money());
                        double d2 = Double.parseDouble(df.format(d1 - intStr));
                        holder.setTextView(R.id.nums, "￥" + d2 * Double.parseDouble(infos.get(position).getNums()));
                        holder.getView(R.id.consent).setTag(R.id.tepi_price, str);
                        if ((Double.parseDouble(infos.get(position).getPackage_money()) - intStr) < 0) {
                            holder.setTextView(R.id.nums, "￥" + 0);
                            holder.getView(R.id.consent).setTag(0);
                        }
                    }

                    @Override
                    public void afterTextChanged(Editable s) {

                    }
                });
                holder.getView(R.id.consent).setOnClickListener(JobTepiDetailsActivity.this);
                holder.getView(R.id.consent).setTag(R.id.holder, holder);

                holder.getView(R.id.consent).setTag(R.id.budget_package_id, infos.get(position).getBudget_package_id());
                holder.getView(R.id.consent).setTag(R.id.apply_id, infos.get(position).getApply_id());
                holder.getView(R.id.consent).setTag(R.id.is_tepi, position);
                holder.getView(R.id.consent_no).setTag(R.id.is_tepi, position);
                holder.getView(R.id.consent_no).setTag(R.id.budget_package_id, infos.get(position).getBudget_package_id());
                holder.getView(R.id.consent_no).setTag(R.id.apply_id, infos.get(position).getApply_id());

                holder.getView(R.id.consent_no).setOnClickListener(JobTepiDetailsActivity.this);
                holder.getView(R.id.consent_no).setTag(R.id.holder, holder);
            }

        });
    }

    private TextView title;
    private JobProjectBean.InfoBean job = new JobProjectBean.InfoBean();
    private ImageView iv_img1;
    private CircularImage iv_head;
    private TextView tv_name, tv_apply, tv_time, tv_authentication;
    private RecyclerView recycler, recycler2;
    private RelativeLayout tepi_detail;
    private LinearLayout ll_recycler;
    private TextView size;
    private Button boss_shenhe;
    private LinearLayout ll_consent_boss, shenhe_ing;
    private TextView boss_edit;
    private TextView consent_status;
    private TextView tv_member;

    private void initView() {
        title = (TextView) findViewById(R.id.view_main_middle_title);
        title.setText("特批详情");
        findViewById(R.id.btn_main_left).setOnClickListener(this);
        //
        iv_head = (CircularImage) findViewById(R.id.iv_head);
        iv_img1 = (ImageView) findViewById(R.id.iv_img1);
        tv_name = (TextView) findViewById(R.id.tv_name);
        tv_member = (TextView) findViewById(R.id.tv_member);
        tv_apply = (TextView) findViewById(R.id.tv_apply);
        tv_authentication = (TextView) findViewById(R.id.tv_authentication);
        tv_time = (TextView) findViewById(R.id.tv_time);
        recycler = (RecyclerView) findViewById(R.id.recycler);
        recycler2 = (RecyclerView) findViewById(R.id.recycler2);
        tepi_detail = (RelativeLayout) findViewById(R.id.tepi_detail);
        tepi_detail.setOnClickListener(this);
        ll_recycler = (LinearLayout) findViewById(R.id.ll_recycler);
        size = (TextView) findViewById(R.id.size);
        boss_edit = (TextView) findViewById(R.id.boss_edit);
        if (job != null && job.getTepi_msg() != null && job.getTepi_status().equals("2")) {
            boss_edit.setText(job.getTepi_msg() + "");
        }
        consent_status = (TextView) findViewById(R.id.consent_status);
        if ("1".equals(job.getTotal_tepi_status())) {
            consent_status.setText("待审核");
        } else if ("2".equals(job.getTepi_status())) {
            consent_status.setText("已通过");

        } else if ("3".equals(job.getTepi_status())) {
            consent_status.setText("已驳回");
        } else if ("4".equals(job.getTepi_status())) {
            consent_status.setText("已处理");
        } else {
            consent_status.setText("待审核");
        }
        boss_shenhe = (Button) findViewById(R.id.boss_shenhe);
        boss_shenhe.setOnClickListener(this);
        shenhe_ing = (LinearLayout) findViewById(R.id.shenhe_ing);
        ll_consent_boss = (LinearLayout) findViewById(R.id.ll_consent_boss);
        //


        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
        linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
        recycler.setLayoutManager(linearLayoutManager);
        LinearLayoutManager linearLayoutManager2 = new LinearLayoutManager(this);
        linearLayoutManager2.setOrientation(LinearLayoutManager.VERTICAL);
        recycler2.setLayoutManager(linearLayoutManager2);
        setInitData();
    }

    private void setInitData() {
        x.image().bind(iv_head, job.getPerson_img());
        //   Log.e("----",job.toString());
        tv_name.setText(job.getRealname());
        tv_member.setText(job.getClassname());
        tv_apply.setText("已申请过" + job.getAll_tepi() + "次特批");
        if ("1".equals(job.getTepi_status())) {
            tv_authentication.setText("待审核");
        } else if ("2".equals(job.getTepi_status())) {
            tv_authentication.setText("已通过");

        } else if ("3".equals(job.getTepi_status())) {
            tv_authentication.setText("已驳回");
        } else if ("4".equals(job.getTepi_status())) {
            tv_authentication.setText("已处理");
        } else {
            tv_authentication.setText("待审核");
        }
        tv_time.setText(job.getCreat_time());
        final List<JobProjectBean.InfoBean.PackageBean> pack = job.getPackageX();
        if (pack.size() == 0) {
            ll_recycler.setVisibility(View.GONE);
        }
        size.setText("共" + pack.size() + "套");
        recycler.setAdapter(new BaseRVAdapter(this, pack) {
            @Override
            public int getLayoutId(int viewType) {
                return R.layout.item_pack;
            }

            @Override
            public void onBind(BaseViewHolder holder, final int position) {
                x.image().bind(holder.getImageView(R.id.img), pack.get(position).getLogo_pic());
                holder.getView(R.id.img).setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent(JobTepiDetailsActivity.this, ProjectListActivity.class);
                        intent.putExtra("budget_id", job.getPackageX().get(position).getBudget_id());
                        intent.putExtra("package_id", job.getPackageX().get(position).getBudget_package_id());
                        intent.putExtra("goods_name", job.getPackageX().get(position).getPackage_name() + "");
                        // Log.e("----", job.getPackageX().get(position).getBudget_id() + "--" + job.getPackageX().get(position).getPackage_id() + "--" + job.getPackageX().get(position).getPackage_name());
                        startActivity(intent);
                    }
                });
            }
        });
    }

    private String total_tepi_stutas;

    private void initData() {
        job = (JobProjectBean.InfoBean) getIntent().getSerializableExtra("bean");
        //  Log.e("---222-", job.toString());

        total_tepi_stutas = getIntent().getStringExtra("total_tepi_stutas");
        // Toast.makeText(JobTepiDetailsActivity.this, "" + job.getApply_id(), Toast.LENGTH_SHORT).show();
    }

    public static final int CONSENT_LI = 111;
    public static final int CONSENT_NO = 112;
    public static final int BOSSTEPI = 113;

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_main_left:
                finish();
                break;
            case R.id.tepi_detail:
//                Intent intent = new Intent(this, CommodityListActivity.class);
//                intent.putExtra("applyId", job.getApply_id());
//                startActivity(intent);
                Intent intent = new Intent(this, ProjectDetailsActivity.class);
                intent.putExtra("budget_id", job.getBudget_id());
                startActivity(intent);


                break;
            case R.id.consent:
//
//                Intent intent = new Intent(this, ConsentDialogActivity.class);
//                intent.putExtra("flag",true);
//                startActivityForResult(intent, CONSENT_LI);
                initDialog(true, v);
                break;
            case R.id.consent_no:
//                Intent intent2 = new Intent(this, ConsentDialogActivity.class);
//                intent2.putExtra("flag",false);
//                startActivityForResult(intent2, CONSENT_NO);
                initDialog(false, v);
                break;
            case R.id.boss_shenhe:
                Intent intent2 = new Intent(this, BossShenHeActivity.class);
                intent2.putExtra("budget_id", job.getBudget_id());
                startActivityForResult(intent2, BOSSTEPI);
                break;
        }
    }

    private String message;

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        switch (requestCode) {
            case BOSSTEPI:
                if (resultCode == RESULT_OK) {
                    boolean isFlag = data.getBooleanExtra("flag", false);
                    message = data.getStringExtra("message");
                    //   boss_edit.setText(message);
                    consent_status.setText(isFlag ? "同意本次审批" : "拒绝本次审批");
                    consent_status.setTextColor(isFlag ? getResources().getColor(R.color.main_color) : Color.RED);
                    ll_consent_boss.setVisibility(View.VISIBLE);
                    shenhe_ing.setVisibility(View.GONE);
                    String budget_id = data.getStringExtra("budget_id");
                    upLoad(false, isFlag, message, budget_id);

//                    Toast.makeText(JobTepiDetailsActivity.this, message + "" + isFlag, Toast.LENGTH_SHORT).show();

                }
                break;
        }
    }

    private void initDialog(final boolean flag, final View v1) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        View view = View.inflate(this, R.layout.dialog_consent, null);
        final EditText edit = (EditText) view.findViewById(R.id.edit);
        TextView consent_1 = (TextView) view.findViewById(R.id.consent_1);
        TextView consent_0 = (TextView) view.findViewById(R.id.consent_0);
        builder.setView(view);

        final AlertDialog show = builder.show();
        Window dialogWindow = show.getWindow();
        WindowManager.LayoutParams lp = dialogWindow.getAttributes();
        dialogWindow.setGravity(Gravity.CENTER_VERTICAL);
        // lp.x = 100; // 新位置X坐标
        //  lp.y = 100; // 新位置Y坐标
        lp.width = getWindowManager().getDefaultDisplay().getWidth(); // 宽度
        //  lp.alpha = 0.7f; // 透明度
        dialogWindow.setAttributes(lp);
        consent_0.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                show.dismiss();
            }
        });
        consent_1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                BaseViewHolder holder = (BaseViewHolder) v1.getTag(R.id.holder);
                //  int position = (int) v.getTag(R.id.tag_group);
                // Toast.makeText(JobTepiDetailsActivity.this, "" + holder, Toast.LENGTH_SHORT).show();
                holder.getTextView(R.id.status).setVisibility(View.VISIBLE);
                holder.getView(R.id.ll_consent).setVisibility(View.GONE);
                holder.getView(R.id.ll_consent1).setVisibility(View.GONE);
                holder.getTextView(R.id.status).setTextColor(flag ? getResources().getColor(R.color.main_color) : Color.RED);
                holder.getTextView(R.id.consent_status).setText(flag ? "已同意" : "已驳回");
                holder.getTextView(R.id.consent_status).setTextColor(flag ? getResources().getColor(R.color.main_color) : Color.RED);
                holder.setTextView(R.id.status, "原因：" + edit.getText());
                show.dismiss();
                int position = (int) v1.getTag(R.id.is_tepi);
                infos.get(position).setTepi(true);

                int nums = 0;
                for (int i = 0; i < infos.size(); i++) {
                    if (infos.get(i).isTepi())
                        nums++;
                }
                if (nums == infos.size()) {
                    shenhe_ing.setVisibility(View.GONE);
                }
                Log.e("---", edit.getText() + "-" + v1.getTag(R.id.apply_id) + "-" + v1.getTag(R.id.budget_package_id) + "-" + v1.getTag(R.id.tepi_price));
                upLoad(flag, edit.getText().toString(), v1.getTag(R.id.apply_id).toString(), v1.getTag(R.id.budget_package_id).toString(), v1.getTag(R.id.tepi_price).toString());
            }


        });
    }

    private void upLoad(boolean flag, String tepi_message, String apply_id, String budget_package_id, String tepi_price) {
        /**
         *  * @param token
         * @param apply_id    //特批记录id
         * @param budget_package_id    //项目套餐ID 购物车ID
         * @param type  1 是待审核  2是通过  3是驳回
         * @param tepi_price    特批价格
         * @param tepi_message    特批意见
         */
        Map<String, Object> map = new HashMap<>();
        map.put("token", MyApplication.getInstance().getUserBean().getToken());
        map.put("apply_id", apply_id);
        map.put("budget_package_id", budget_package_id);
        map.put("type", flag ? 2 : 3);
        map.put("tepi_price", tepi_price);
        map.put("tepi_message", tepi_message);
        Set keys = map.keySet();
        if (keys != null) {
            Iterator iterator = keys.iterator();

            while (iterator.hasNext()) {
                Object key = iterator.next();
                Object value = map.get(key);
                Log.e("" + key, ":" + value + "\n");
            }
        }
        //   if (true) return;
        XUtil.Post(Url.UCENTER_TEPI, map, new MyCallBack<String>() {
            @Override
            public void onSuccess(String result) {
                Log.e("----3333", result);

                super.onSuccess(result);
            }

            @Override
            public void onFinished() {
                super.onFinished();
            }

            @Override
            public void onError(Throwable ex, boolean isOnCallback) {
                super.onError(ex, isOnCallback);
            }
        });
    }

}
